﻿using System;
using System.Collections.Generic;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace OnlineTest.UC
{
    public partial class UCTestCheckbox : UCTest
    {
        protected void Page_Load(object sender, EventArgs e)
        {
        }

        public override object GetData()
        {
            List<string> items = new List<string>();
            foreach (ListItem item in cblItems.Items)
            {
                if (item.Selected) items.Add(item.Value.ToString());
            }
            return items;
        }

        public override bool LoadData(object data)
        {
            cblItems.Items.Clear();
            List<string> lData = (List<string>) data;
            foreach (string s in lData)
            {
                cblItems.Items.Add(s);
            }
            return true;
        }
    }
}